#include "tools.h"
#include "Visualisation.h"
#include <sstream>

void SplitPath(const string& pathAndFilename, string& path, string& filename)
{
	string fullPath(pathAndFilename);
	//fullPath.replace(fullPath.begin(), fullPath.end(), '\\', '/');

	string::size_type lastSlashPos=fullPath.find_last_of('\\');

	if(lastSlashPos==string::npos)
	{
		path="";
		filename=fullPath;
	}
	else
	{
		path=fullPath.substr(0, lastSlashPos);
		filename=fullPath.substr(lastSlashPos+1, fullPath.size()-lastSlashPos-1);
	}
}

void displayPosition(D3DXVECTOR3 position)
{
	stringstream ss;
	string text;

	string value;
	ss<<position.x;
	ss>>value;
	text="X = ";
	text.append(value);
	OutputDebugString(text.c_str());

	ss.clear();
	value.clear();
	text.clear();
	ss<<position.y;
	ss>>value;
	text=" Y = ";
	text.append(value);
	OutputDebugString(text.c_str());

	ss.clear();
	value.clear();
	text.clear();
	ss<<position.z;
	ss>>value;
	text=" Z = ";
	text.append(value);
	text.append("\n");
	OutputDebugString(text.c_str());

}

void displayNumber(float number)
{
	stringstream ss;
	string s;

	ss<<number;
	ss>>s;
	OutputDebugString(s.c_str());
}